﻿@using Orchard.Utility.Extensions
@using Orchard.ContentManagement
@using Wng.Deployment.ViewModels
@using Wng.Deployment.Models
@model SubscriptionsViewModel
@{
  var index = 0;

  var pageSizes = new List<int?>() { 10, 50, 100 };
  var defaultPageSize = WorkContext.CurrentSite.PageSize;
  if (!pageSizes.Contains(defaultPageSize))
  {
    pageSizes.Add(defaultPageSize);
  }

  Layout.Title = T("Schedule Deployments");
}

@using (Html.BeginFormAntiForgeryPost())
{ 
  @Html.ValidationSummary()
   
  <fieldset class="bulk-actions">
    <input type="hidden" name="Page" value="1" />
    <label for="pageSize">@T("Show:")</label>
    <select id="pageSize" name="PageSize">
      @Html.SelectOption((int)Model.Pager.PageSize, 0, T("All").ToString())
      @foreach (int size in pageSizes.OrderBy(p => p))
      {
        @Html.SelectOption((int)Model.Pager.PageSize, size, size.ToString())
      }
    </select>
    <button type="submit" name="submit.Filter" value="@T("Filter")">@T("Filter")</button>
  </fieldset>
  <div class="manage">
    @Html.ActionLink(T("Add a new subscription").ToString(), "Create", new { }, new { @class = "button primaryAction" })
  </div>
  <fieldset>
    @Html.Partial("_SubscriptionList", Model)
    @Display(Model.Pager)
  </fieldset>
}